<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateKmsTaskTemplateNodes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('kms_task_template_nodes', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger("templateId")->comment("任务模板ID kms_task_template.id")->default(0);
            $table->unsignedTinyInteger("step")->comment("步骤")->default(1);
            $table->unsignedTinyInteger("preStep")->comment("驳回回滚步骤")->default(0);
            $table->unsignedTinyInteger("businessType")->comment("任务节点业务类型 eg.创建任务｜提交表单｜审批")->default(0);
            $table->string("businessTypeText")->comment("任务节点业务类型文本")->default("");
            $table->json("businessStatusEnum")->comment("常规任务节点状态枚举")->nullable(true);
            $table->json("rejectBusinessStatusEnum")->comment("驳回任务节点状态枚举")->nullable(true);
            $table->unsignedTinyInteger("handleType")->default(0)->comment("节点处理类型 0 - 有一人处理即可");
            $table->unsignedTinyInteger("approveType")->default(0)->comment("审批节点类型");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '(表注释)';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('kms_task_template_nodes');
    }
}
